<!--
 * 严肃声明：
 * 开源版本请务必保留此注释头信息，若删除我方将保留所有法律责任追究！
 * 本系统已申请软件著作权，受国家版权局知识产权以及国家计算机软件著作权保护！
 * 可正常分享和学习源码，不得用于违法犯罪活动，违者必究！
 * Copyright (c) 2020 陈尼克 all rights reserved.
 * 版权所有，侵权必究！
 *
-->

<template>
  <div class="cart-box">
    <div>
      <s-header :name="'一起云养成'" :noback="true"></s-header>
    </div>
    <div class="liveBox">
      <div class="liveItem" v-for="(item, index) in list" v-bind:key="index" @click="toVideo(item.source)">
        <div class="living"  v-show="item.isLiving"><van-icon name="bulb-o" />直播中</div>
        <div class="bgImg" :style="{backgroundImage:'url('+item.bgImg+')'}"></div>
        <div class="mask">
          <div class="maskTop">
            <div class="avatar" :style="{backgroundImage:'url('+item.avatar+')'}"></div>
            <div class="title">{{item.name}}</div>
            <div class="content">{{item.content}}</div>
          </div>
        </div>
      </div>
    </div>
    <nav-bar></nav-bar>
  </div>
</template>

<script>
import { onMounted } from "vue";
import navBar from "@/components/NavBar";
import sHeader from "@/components/SimpleHeader";

export default {
  components: {
    navBar,
    sHeader,
  },
  data() {
    return {
      list: [{
        isLiving:true,
        bgImg:'https://img1.baidu.com/it/u=707280345,1135263565&fm=26&fmt=auto&gp=0.jpg',
        avatar:'https://tse1-mm.cn.bing.net/th?id=OIP-C.Bi_6Mpybm8VdK6zXUUZpwQHaHa&w=135&h=135&c=8&rs=1&qlt=90&o=6&dpr=3&pid=3.1&rm=2',
        name:'山东小萍',
        content:'农家散养五谷鸡蛋',
        source:"http://player.alicdn.com/video/aliyunmedia.mp4"
      },{
        isLiving:true,
        bgImg:'https://img0.baidu.com/it/u=3803869903,2244085008&fm=26&fmt=auto&gp=0.jpg',
        avatar:'https://img0.baidu.com/it/u=3155998395,3600507640&fm=26&fmt=auto&gp=0.jpg',
        name:'江苏小冬',
        content:'新鲜前腿肉',
        source:"https://player.alicdn.com/video/apsaravideo4k.mp4"
      },{
        isLiving:false,
        bgImg:'https://img0.baidu.com/it/u=1510428663,3935674840&fm=26&fmt=auto&gp=0.jpg',
        avatar:'https://img2.baidu.com/it/u=1704219071,3761829583&fm=26&fmt=auto&gp=0.jpg',
        name:'广东小霏',
        content:'手打牛肉丸',
        source:"http://player.alicdn.com/video/editor.mp4"
      },{
        isLiving:true,
        bgImg:'https://img1.baidu.com/it/u=1329500959,2729678556&fm=26&fmt=auto&gp=0.jpg',
        avatar:'https://img1.baidu.com/it/u=729283109,1369002854&fm=26&fmt=auto&gp=0.jpg',
        name:'浙江小刘',
        content:'家养走地鸡',
        source:"http://player.alicdn.com/resource/player/qupai.mp4"
      }]
    };
  },
  setup() {
    onMounted(() => {});

    return {};
  },
  methods:{
    toVideo(source){
      window.location.href='http://mall.coderbear.xyz/video.html?source='+source
    }
  }
};
</script>

<style lang="less">
@import "../common/style/mixin";
.liveBox {
  padding: 14px 10px;
  box-sizing: border-box;
  min-height: 200px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .liveItem {
    .living {
      width: 60px;
      height: 20px;
      font-size: 1em!important;
      background-color: #f62f65;
      background-image: linear-gradient(to right,#F67DA4,#F4396B);
      border-radius: 4px;
      position: absolute;
      margin: 6px 8px;
      color: #FFF;
      display: flex;
      justify-content: center;
      align-items: center;
      box-sizing: border-box;
    }
    background-color: #ddd;
    height: 200px;
    width: 48%;
    margin-bottom: 14px;
    border: 1px solid #eee;
    box-shadow: 5px 5px 5px #eee;
    border-radius: 6px;
    .bgImg {
      height: 80%;
      background-position: center;
      background-size: cover;
    }
    .mask {
      width: 100%;
      height: 20%;
      position: relative;

      .maskTop {
        height: 172%;
        width: 100%;
        // border-radius: 24% 24% 0 0;
        background-color: #fff;
        position: absolute;
        top: -30px;
        z-index: 99;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;

        .avatar {
          position: absolute;
          top: -36px;
          height: 50px;
          width: 50px;
          background-color: #fff;
          border-radius: 50%;
          background-size: contain;
          border: 1px solid #ddd;
        }
        .title {
          color: #555555;
          font-size: 16px;
        }
        .content {
          color: #eb6f94;
          font-size: 14px;
          font-weight: bold;
        }
      }
    }
  }
}
</style>
